package gui;

import java.awt.BorderLayout;

import javax.swing.ImageIcon;
import javax.swing.JLabel;

public class VentanaImagen extends javax.swing.JFrame {
	private JLabel lblImagen;

	public VentanaImagen() {
		super();
		getContentPane().setLayout(new BorderLayout(0, 0));
		lblImagen = new JLabel("");
		getContentPane().add(lblImagen, BorderLayout.CENTER);
		initGUI();
	}

	private void initGUI() {
		try {
		} catch (Exception e) {
			// add your error handling code here
			e.printStackTrace();
		}
		this.setVisible(false);
	}

	/**
	 * Metodo que permite fijar la imgane a mostrar en la ventana.
	 * 
	 * @param icon
	 *            ImagenIcon a ser mostrada.
	 */
	public void setIcon(ImageIcon icon) {
		this.setSize(icon.getIconWidth(), icon.getIconHeight());
		lblImagen.setIcon(icon);
		this.repaint();
		this.setLocationRelativeTo(getParent());
		this.setVisible(true);
	}

}
